<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--       
*     Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
*     Use is subject to license terms.
-->
<html>
<head>
	<title>Rename a Function or Variable</title>
<link href="nbdocs:/org/netbeans/modules/usersguide/ide.css"  rel="stylesheet" type="text/css"></head>
<body>
<h2><b>Rename</b> a Function or Variable</h2>
<p> <small><a href="#seealso">See Also</a></small> 


<p><b>To rename a function or variable  and update  references to that element: </b></p>
<ol>
<li>In the Source editor, right-click the function or variable and choose Refactor > Rename  from the  contextual menu.</li>
<li>In the Rename Field  dialog box, type the New Name.<br/> 
Select the Apply Rename on Comments checkbox to apply renaming on all occurrences of that element  in comments.</li>
<li>To apply the changes to the code, do one of the following:
  <ul>
<li>Click the Refactor button. <br>
    The IDE instantly applies all the changes. </li>
<li>Click the Preview button.<br>
    The Refactoring window displays all lines of code that will be changed. Review the changes and clear the checkbox for any code that you do not want to  change. Click the Do Refactoring button to apply the changes. </li>
</ul>
</ol>
<!--<p><ul class="note">
<li>For quick in-place renaming, place the cursor in the element that you want to rename and press Ctrl-R. Then type the new name. To complete renaming, press </li></ul></p>
-->
<dl>
<dt><a name="seealso">See Also</a></dt>
<dd><a href="refactor_quick_ref.html">Refactoring: Quick Reference </a></dd>
<dd><a href="rename_class.html">Renaming a Class </a></dd>
<dd><a href="undo_refactor_changes.html">Undoing Refactoring Changes</a></dd>
</dl>

<hr>
<p><font size=-2><a href="../credits.html">Legal Notices</a></font>
</p>
<table cellpadding="50" border="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

</body>
</html>
